<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./template.xhtml">

    <ui:define name="title">
        Quản lý phiên làm việc
    </ui:define>

    <ui:define name="content">
        <h:form>

            <p:dataTable id="table" value="#{activeUserBean.list}" var="item" paginator="#{activeUserBean.list.size() >20}" rows="20" 
                         selection="#{activeUserBean.selectedList}" selectionMode="multiple" resizableColumns="true">

                <f:facet name="header">  
                    <div align="left">
                        <p:commandButton value="Xóa" image="ui-icon ui-icon-close" onclick="deleteConfirm.show()" />   
                    </div>
                </f:facet> 

                <f:facet name="footer">  
                    <div align="left">
                        <p:commandButton value="Xóa" image="ui-icon ui-icon-close" onclick="deleteConfirm.show()" />   
                    </div>
                </f:facet> 

                <p:column headerText="Username" sortBy="#{item.username}">
                    #{item.username}
                </p:column>
            </p:dataTable>

            <p:confirmDialog modal="true" message="Bạn muốn xóa các bản ghi đã chọn?"  
                             hideEffect="explode"  
                             header="Xác nhận" severity="alert" widgetVar="deleteConfirm">  

                <p:commandButton update="table" value="Có" oncomplete="deleteConfirm.hide()"  
                                 action="#{activeUserBean.removeSelected()}"/>
                <p:commandButton value="Không" onclick="deleteConfirm.hide()" type="button" />   

            </p:confirmDialog> 

        </h:form>
    </ui:define>

</ui:composition>
